---
layout: m1x_soap
title: Catalog Product Tag
---

<h2><a name="MAPI-ProductTag-Module%3ATag"></a>Module: Tag</h2>

<p>Allows you to operate with product tags.</p>


<h4><a name="MAPI-ProductTag-Resource%3Acatalogproducttag"></a>Resource: catalog_product_tag</h4>

<p><b>Aliases</b>: product_tag</p>

<h5><a name="MAPI-ProductTag-Methods%3A"></a>Methods:</h5>


<ul>
	<li><a href="product_tag.list.html" title="product_tag.list">product_tag.list</a> &#45; Retrieve the list of tags by the product ID</li>
	<li><a href="product_tag.info.html" title="product_tag.info">product_tag.info</a> &#45; Retrieve information about a product tag</li>
	<li><a href="product_tag.add.html" title="product_tag.add">product_tag.add</a> &#45; Add one or more tags to a product</li>
	<li><a href="product_tag.update.html" title="product_tag.update">product_tag.update</a> &#45; Update an existing product tag</li>
	<li><a href="product_tag.remove.html" title="product_tag.remove">product_tag.remove</a> &#45; Remove a product tag</li>
</ul>





<h5><a name="MAPI-ProductTag-Faults%3A"></a>Faults:</h5>


<table><tbody>
<tr>
<th> <font color="#333333">Fault Code</font> </th>
<th> <font color="#333333">Fault Message</font> </th>
</tr>
<tr>
<td> <font color="#333333">101</font> </td>
<td> <font color="#333333">Requested store does not exist.</font> </td>
</tr>
<tr>
<td> <font color="#333333">102</font> </td>
<td> <font color="#333333">Requested product does not exist.</font> </td>
</tr>
<tr>
<td> <font color="#333333">103</font> </td>
<td> <font color="#333333">Requested customer does not exist.</font> </td>
</tr>
<tr>
<td> <font color="#333333">104</font> </td>
<td> <font color="#333333">Requested tag does not exist.</font> </td>
</tr>
<tr>
<td> <font color="#333333">105</font> </td>
<td> <font color="#333333">Provided data is invalid.</font> </td>
</tr>
<tr>
<td> <font color="#333333">106</font> </td>
<td> <font color="#333333">Error while saving tag. Details in error message.</font> </td>
</tr>
<tr>
<td> <font color="#333333">107</font> </td>
<td> <font color="#333333">Error while removing tag. Details in error message.</font> </td>
</tr>
</tbody></table>


<h5><a name="MAPI-ProductTag-Example%3A"></a>Example:</h5>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');
$productId = 2;
$customerId = 10002;
$store = 'default';

// Add tags
$data = array('product_id' =&gt; $productId, 'store' =&gt; $store, 'customer_id' =&gt; $customerId, 'tag' =&gt; "First 'Second tag' Third");
echo "Adding Tag... ";
$addResult = $proxy-&gt;call(
    $sessionId,
    "product_tag.add",
    array($data)
);
echo ((count($addResult) == 3) ? "Done!" : "Fail!");
echo "&lt;br /&gt;";
print_r($addResult);
$tagId = reset($addResult);

// Get tag info
echo "&lt;br /&gt;Get Tag Info (id = $tagId)... ";
$infoResult = $proxy-&gt;call(
    $sessionId,
    "product_tag.info",
    array($tagId, $store)
);
echo "Done!&lt;br /&gt;";
print_r($infoResult);

// Update tag data
$data = array('status' =&gt; -1, 'base_popularity' =&gt; 12, 'name' =&gt; 'Changed name');
echo "&lt;br /&gt;Update Tag (id = $tagId)... ";
$updateResult = $proxy-&gt;call(
    $sessionId,
    "product_tag.update",
    array($tagId, $data, $store)
);
echo ($updateResult ? "Done!" : "Fail!");

// Retrieve list of tags by product
echo "&lt;br /&gt;Tag list for product with id = $productId... ";
$listResult = $proxy-&gt;call(
    $sessionId,
    "product_tag.list",
    array($productId, $store)
);
echo (count($listResult) ? "Done!" : "Fail!");
echo "&lt;br /&gt;";
print_r($listResult);

// Remove existing tag
echo "&lt;br /&gt;Remove Tag (id = $tagId)... ";
$removeResult = $proxy-&gt;call(
    $sessionId,
    "product_tag.remove",
    array($tagId)
);
echo ($removeResult ? "Done!" : "Fail!");</pre>
		</div>
</div></div>

				    
Create the Magento文件系统所有者                   			    
